package com.zhku.analysis.controller;
/*
 *  @author : 钱伟健 gonefuture@qq.com
 *  @version    : 2018/4/2 21:32.
 *  说明：
 */

import com.zhku.analysis.enyity.UserEveryday;
import com.zhku.analysis.enyity.UserHourly;
import com.zhku.analysis.service.ResultService;
import org.codehaus.jettison.json.JSONException;
import org.codehaus.jettison.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;

/**
 * <pre> <pre>
 */
@RestController
public class APPTimeController {


    @Autowired
    private ResultService resultService;

    @GetMapping("/")
    public String index(String rowKey) {
        return "hello";
    }



    @GetMapping("UserApptimeEveryday")
    public Object userApptimeEveryday(String rowKey) {
        return resultService.getEveryday(rowKey);
    }




    @GetMapping("scanEveryDay")
    public List<UserEveryday> scanEveryDay(String startKey, String stopKey,String pageSize) {
        return resultService.getStartRowAndEndRow("userEveryday",
                startKey, stopKey,pageSize);

    }


    @GetMapping("scanHourly")
    public String scanHourly(String startKey, String stopKey, String pageSize) {

       return resultService.getJson("userHourly",startKey,stopKey,pageSize).toString();
    }



}
